package com.twu.biblioteca.services;

public enum MenuOption {
    LIST_BOOKS(1),
    RESERVE_BOOK(2),
    CHECK_MEMBERSHIP(3),
    LIST_MOVIES(4),
    LOGIN(5),
    EXIT(6),
    INVALID(-1);

    private final int value;

    private MenuOption(int value){
        this.value = value;
    }

    public int getValue(){
        return this.value;
    }

    public static MenuOption fromInt(int value){
        switch (value) {
            case 1:
                return LIST_BOOKS;

            case 2:
                return RESERVE_BOOK;

            case 3:
                return CHECK_MEMBERSHIP;

            case 4:
                return LIST_MOVIES;

            case 5:
                return LOGIN;

            case 6:
                return EXIT;

            default:
                return INVALID;
        }
    }
}
